package com.session01;

public class Employee {
    public String name; //姓名
    public String address; //邮寄地址
    public int SSN; //社保号
    public int number; //员⼯号

    //邮寄⽀票
    public void mailCheck() {
        System.out.println("将员⼯" + this.name + "的⽀票寄到 " + this.address);
    }

    @Override
    public String toString() {
        return "员⼯号为" + this.number + "的员⼯姓名为：" + this.name + " 社保号为：" + this.SSN + " 地址为：" + this.address;
    }

    @Override
    public boolean equals(Object x) {
        if (x == null) {
            return false;
        }
        Employee e = (Employee) x;
        if (this.number == e.number) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return this.number;
    }
}
